// 用户评论
.comments {
  .comments_title {
    display: flex;
    align-items: center;
    font-size: 1.5em;
    font-weight: bold;
    margin: 2rem 0;
    color: var(--el-text-color-primary);

    span {
      margin-left: 0.5rem;
    }
  }

  .comments-list {
    margin-top: 1.5rem;

    .comment-item {
      display: flex;
      margin-bottom: 1.5rem;
      padding: 1.2rem;
      background: var(--el-fill-color-blank);
      border-radius: 12px;
      border: 1px solid var(--el-border-color-lighter);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
      transition: all 0.3s ease;

      &:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        border-color: var(--el-border-color-light);
      }

      .comment-avatar {
        flex-shrink: 0;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      }
    }
  }

  .form_container {
    padding: 1.2rem 1.5rem;
    background: var(--el-fill-color-blank);
    border-radius: 12px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid var(--el-border-color-lighter);
    transition: all 0.3s ease;

    &:hover {
      box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.1);
      border-color: var(--el-border-color);
    }

    .textarea {
      resize: none;
      padding: 0.8rem 1rem;
      width: 100%;
      height: 7em;
      border-radius: 8px;
      line-height: 1.6em;
      border: 1px solid var(--el-border-color);
      background: var(--el-fill-color-blank);
      transition: all 0.3s ease;
      font-size: 0.95rem;

      &:focus {
        outline: none;
        border-color: var(--el-color-primary);
        box-shadow: 0 0 0 2px var(--el-color-primary-light-9);
      }

      &::placeholder {
        color: var(--el-text-color-placeholder);
      }
    }

    .preview {
      margin-top: 1rem;
      padding: 1rem;
      width: 100%;
      min-height: 4em;
      height: 100%;
      border-radius: 8px;
      line-height: 1.6em;
      border: 1px solid var(--el-border-color-lighter);
      background: var(--el-fill-color-light);
      box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    // 预览框markdown 默认内边距
    :deep(.md-editor-preview-wrapper) {
      padding: 0;
    }

    // 图片默认样式
    :deep(.default-theme img) {
      border: none;
      width: 40px;
      height: 40px;
      // 图片不可放大
      pointer-events: none;
      // 跟文字对齐
      vertical-align: middle;
    }

    .btn {
      position: relative;
      display: flex;
      justify-content: space-between;
      margin-top: 1rem;

      .emojis_container {
        z-index: 10;
        position: absolute;
        top: 2.5em;
        width: 25em;
        height: 20em;
        background: var(--el-fill-color-blank);
        border: 1px solid var(--el-border-color-light);
        border-radius: 10px;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
        overflow: hidden;

        .OvO_heo {
          div {
            display: flex;
            flex-wrap: wrap;
            width: 100%;
            height: 100%;
            padding: 0.5rem;
            cursor: pointer;

            img {
              width: 3em;
              height: 3em;
              border-radius: 6px;
              transition: all 0.2s ease;

              &:hover {
                background-color: var(--el-fill-color-light);
                transform: scale(1.1);
              }
            }
          }
        }

        .OvO_emojis {
          display: flex;
          flex-wrap: wrap;
          padding: 0.5rem;

          div {
            font-size: 1.8rem;
            width: 1.5em;
            height: 1.8em;
            color: var(--el-text-color-regular);
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            border-radius: 6px;
            transition: all 0.2s ease;

            &:hover {
              background-color: var(--el-fill-color-light);
              transform: scale(1.15);
            }
          }
        }

        .OvO_options {
          position: relative;
          background: var(--el-fill-color-blank);
          display: flex;
          flex-wrap: wrap;
          justify-content: flex-start;
          width: 100%;
          border-top: 1px solid var(--el-border-color-lighter);
          padding: 0.3rem;

          .item_emoji {
            width: 3em;
            height: 2em;
            color: var(--el-text-color-regular);
            display: flex;
            justify-content: center;
            align-items: center;
            margin-right: 0.26rem;
            cursor: pointer;
            border-radius: 6px;
            font-size: 0.9rem;
            font-weight: 500;
            transition: all 0.2s ease;

            &:first-child {
              background-color: var(--el-color-primary);
              color: white;
            }

            &:hover {
              background-color: var(--el-fill-color);
            }
          }
        }
      }
    }

  }
}

// 评论内容
.comment_content {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-left: 1rem;

  .comment_content_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;

    div {
      display: flex;
      margin: 0 0.2rem;
      align-items: center;

      & div:nth-child(1) {
        font-weight: 600;
        font-size: 0.95rem;
        color: var(--el-text-color-primary);

        &:hover {
          color: var(--el-color-primary);
          cursor: pointer;
          transition: color 0.3s ease;
        }
      }

      & div:last-child {
        margin-left: 1.2rem;
        font-size: 0.8rem;
        color: var(--el-text-color-secondary);
      }
    }
  }

  .comment_content_body {
    font-size: 0.92rem;
    margin: 0.3rem 0;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background-color: var(--mao-bg-comment);
    line-height: 1.6em;
    border-left: 3px solid var(--el-color-primary-light-7);

    .parent-comment-content {
      display: block;
      width: 100%;
      word-wrap: break-word;
      word-break: break-word;
      overflow-wrap: break-word;
    }
  }

  .comment_content_footer {
    display: flex;
    font-size: 0.75rem;
    color: var(--el-text-color-secondary);
    margin-top: 0.8rem;
    justify-content: flex-end;

    div {
      display: flex;
      align-items: center;
      padding: 0.3rem 0.6rem;
      border-radius: 6px;
      transition: all 0.3s ease;

      &:hover {
        background: var(--el-fill-color-light);
      }
    }

    div:last-child {
      margin-left: 0.5rem;
    }

    div:first-child {
      margin-right: 0.5rem;
    }
  }
}

// 修改
.comment_content_body {
  // h1 - h6
  :deep(.default-theme h1) {
    font-size: 1.5em;
  }

  :deep(.default-theme h2) {
    font-size: 1.3em;
  }

  :deep(.default-theme h3) {
    font-size: 1.1em;
  }

  :deep(.default-theme h4) {
    font-size: 1em;
  }

  :deep(.default-theme h5) {
    font-size: 0.9em;
  }

  :deep(.default-theme h6) {
    font-size: 0.8em;
  }

  :deep(.default-theme h1),
  :deep(.default-theme h2),
  :deep(.default-theme h3),
  :deep(.default-theme h4),
  :deep(.default-theme h5),
  :deep(.default-theme h6) {
    margin: 0;
    line-height: 1.2em;
  }

  :deep(.default-theme pre) {
    margin: 0;
    background-color: #f6f8fa;
    //border-radius: 0.3em;
    //padding: 0.4em;
    overflow: auto;
  }

  // 表情包
  :deep(.default-theme img) {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    border-style: none;
    padding: 0;
    margin: 0 0.3rem;
  }

  // 列表
  :deep(.default-theme ol),
  :deep(.default-theme ul) {
    margin: 0;
  }

  :deep(.md-editor-preview-wrapper) {
    padding: 0;
    margin: 0;
    background: var(--mao-bg-comment);
  }

  // 普通文字
  :deep(.default-theme p) {
    padding: 0;
    font-size: 0.9rem;
    margin: 0.5rem 0;
    word-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
  }
}

// 表情包图片
:deep(.medium-zoom-image) {
  pointer-events: none;
  margin: 0;
}

// 预览图片表情包
:deep(.md-editor-preview p span img){
  display: inline;
}
